# -*- coding : utf_8 -*-
"""
=======================================
Time : 2025/4/8 15:37
Author : 田霄汉
Email : 522989570@qq.com
File : pandas_class03.py
Project : pandas_demo
Function : 初识series
=======================================
"""

import pandas as pd


# 行是row，列是column
# 生成序列对象
s1 = pd.Series([100, 200, 300], index=['x', 'y', 'z'])
print(s1)

# 将series以dict的形式加到DataFrame中
s1 = pd.Series(data=[1, 2, 3], index=[1, 2, 3], name='A')
s2 = pd.Series(data=[10, 20, 30], index=[1, 2, 3], name='B')
s3 = pd.Series(data=[100, 200, 300], index=[2, 3, 4], name='C')
df = pd.DataFrame({s1.name: s1, s2.name: s2, s3.name: s3})
print(df)

# 以list形式加进去则与dict刚好相反
df = pd.DataFrame([s1, s2, s3])
print(df)
